<template>
	<view v-if="pageShow">
		<!-- <view class="mainpadding ffffff">
			<view class="flexbetween">
				<view class="ershiba nofonweight xiaohei">订单号：</view>
				<view class="ershiba nofonweight xiaohei">100元</view>
			</view>
		</view> -->
		<view class="mainpadding ffffff">
			<view class="xiahuaxian flexbetween">
				<view class="ershiba nofonweight xiaohei">发票抬头：</view>
				<input class="textright" type="text" placeholder="请输入发票抬头" v-model="fptt">
			</view>
			<view class="xiahuaxian flexbetween margin_top">
				<view class="ershiba nofonweight xiaohei">纳税人识别号：</view>
				<input class="textright" type="text" placeholder="请输入纳税人识别号" v-model="nsrsbh">
			</view>
			<view class="xiahuaxian flexbetween margin_top">
				<view class="ershiba nofonweight xiaohei">发票内容：</view>
				<input class="textright" type="text" placeholder="请输入发票内容" v-model="fpnr">
			</view>
			<view class=" flexbetween margin_top">
				<view class="ershiba nofonweight xiaohei">总额：</view>
				<view class="ershiba nofonweight xiaohei">{{dataAll.price}}元</view>
			</view>
		</view>
		<view class="mainpadding ffffff margin_top1">
			<view class="xiahuaxian flexbetween">
				<view class="ershiba nofonweight xiaohei">手机号：</view>
				<input class="textright" type="number" placeholder="请输入手机号" v-model="mobile">
			</view>
			<view class="flexbetween margin_top">
				<view class="ershiba nofonweight xiaohei">邮箱地址：</view>
				<input class="textright" type="text" placeholder="请输入邮箱地址" v-model="email">
			</view>
		</view>
		<!-- 固定底部 -->
		<view class="gudingdb mainpadding">
			<view class="flexcenter" @click="checkflag=!checkflag">
				<!-- 已选中 -->
				<view class="" v-if="checkflag">
					<u-icon class="margin_right1" name="checkmark-circle-fill" color="#1BA95B" size="22"></u-icon>
				</view>
				<view class="" v-if="!checkflag">
					<u-icon class="margin_right1" name="checkmark-circle-fill" color="#999" size="22"></u-icon>
				</view>
				<view class="flexleft ershil nofonweight xiaohei">
					请仔细阅读并同意
					<view class="ershil nofonweight xiaolv" @click.stop="jumpurl('/pages/system/system')">《开具发票规则》</view>
				</view>
			</view>
			<view class="bigbtn margin_top" @click="submit">提交申请</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				checkflag: false,
				pageShow: false,
				listid: "",
				dataAll:{},
				fptt:"",
				nsrsbh:"",
				fpnr:"",
				mobile:"",
				email:"",
			}
		},
		onLoad(options) {
			this.listid = options.id
			this.getDetail()
		},
		methods: {
			submit() {
				if(this.fptt==""){
					httpRequest.toast("请输入发票抬头")
					return false
				}
				if(this.nsrsbh==""){
					httpRequest.toast("请输入纳税人识别号")
					return false
				}
				if(this.fpnr==""){
					httpRequest.toast("请输入发票内容")
					return false
				}
				if(this.mobile==""){
					httpRequest.toast("请输入手机号")
					return false
				}
				if(this.email==""){
					httpRequest.toast("请输入邮箱地址")
					return false
				}
				if(this.checkflag==false){
					httpRequest.toast("请仔细阅读开具发票规则并勾选")
					return false
				}
				uni.showLoading({
					mask:true,
					title:"请稍后"
				})
				httpRequest.request('/api/Fpqdcl/addFpqdApply', 'GET', {
					fptt:this.fptt,
					nsrsbh:this.nsrsbh,
					fpnr:this.fpnr,
					mobile:this.mobile,
					email:this.email,
					fbqd_id:this.listid,
				}).then(res => {
					uni.hideLoading()
					httpRequest.toast(res.msg)
					if(res.code==1){
						setTimeout(()=>{
							uni.navigateBack(1)
						},1000)
					}
				})
			},
			getDetail() {
				httpRequest.request('/api/Fpqdcl/indexDetail', 'GET', {
					id:this.listid
				}).then(res => {
					this.dataAll = res.data
					this.pageShow = true
				})
			},
			jumpurl(url){
				uni.navigateTo({
					url
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	page {
		background: #F9F9F9;
	}
</style>